package com.fight.strive.sys.modules.scheduler.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fight.strive.sys.modules.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.time.LocalDateTime;

/**
 * 作业调度记录
 *
 * @author ZHOUXIANG
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Entity
@Table(name = "t_sys_sch_record",
        indexes = {
                @Index(columnList = "jobId"),
                @Index(columnList = "jobCode"),
                @Index(columnList = "status")})
@TableName("t_sys_sch_record")
public class SchRecordEntity extends BaseEntity {

    /**
     * 作业ID
     */
    private Long jobId;

    /**
     * 任务编号
     */
    private String jobCode;

    /**
     * 作业名称
     */
    private String jobName;

    /**
     * 执行状态
     *
     * @see com.fight.strive.sys.modules.scheduler.constants.SchConstants
     */
    private String status;

    /**
     * 异常堆栈信息
     */
    @Column(columnDefinition = "text")
    private String stackTrace;

    /**
     * 执行开始时间
     */
    private LocalDateTime startTime;

    /**
     * 执行结束时间
     */
    private LocalDateTime endTime;
}
